package com.example.schoolenterprisealliance.adapter;
//最新动态
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.schoolenterprisealliance.MainActivity;
import com.example.schoolenterprisealliance.R;
import com.example.schoolenterprisealliance.activity.DynamicActivity;
import com.example.schoolenterprisealliance.bean.NewIfomation;
import com.example.schoolenterprisealliance.dialog.CancelDialog;
import com.example.schoolenterprisealliance.dialog.MyDialog;
import com.example.schoolenterprisealliance.html.HtmlText;
import com.example.schoolenterprisealliance.io.MyBitmap;
import com.example.schoolenterprisealliance.time.Time;

import java.io.IOException;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class New_InformationAdapter extends BaseQuickAdapter<NewIfomation.DataBean,BaseViewHolder> {
    private ImageView iv_cancel;
    private CancelDialog cancelDialog;
    private Context context;
    private List<NewIfomation.DataBean> data;
    public New_InformationAdapter(int layoutResId, @Nullable List<NewIfomation.DataBean> data,Context context) {
        super(layoutResId, data);
        this.context=context;
        this.data=data;
    }
    @Override
    protected void convert(@NonNull BaseViewHolder helper, NewIfomation.DataBean item) {
        Log.d("imgurl", item.getImgUrl());

        helper.addOnClickListener(R.id.iv_cancel);

        try {
            helper.setText(R.id.tv_context, HtmlText.Html.delHTMLTag(item.getContext()))
                    .setText(R.id.tv_time, Time.longToString(item.getTime()))
                    .setImageBitmap(R.id.iv_img, MyBitmap.getBitmap(item.getImgUrl()));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
